In [73]:
# APIKEY = 422004d03a794f1db979e02a81969b56
import requests
response = requests.get("https://api.nytimes.com/svc/books/v3/lists.json?list=hardcover-fiction&published-date=2009-05-10&api-key=422004d03a794f1db979e02a81969b56")
data = response.json()
#print (data)
#print(data.keys())
In [74]:
#print(data['results'])
#print(data['results'][0])
#print(data['results'][0]['book_details'][0])
#print(data['results'][0]['book_details'][0]['title'])
In [75]:
print("On Mother's Day in 2009, the following books topped the bestseller list: " )
for item in data['results']:
for item in item['book_details']:
print(item['title'])
In [76]:
#request data
import requests
response = requests.get("https://api.nytimes.com/svc/books/v3/lists.json?list=hardcover-fiction&published-date=2010-05-09&api-key=422004d03a794f1db979e02a81969b56")
data = response.json()
#print books on hardcover fiction bestseller list
print("On Mother's Day in 2010, the following books topped the bestseller list: " )
for item in data['results']:
for item in item['book_details']:
print(item['title'])
In [77]:
#request data
import requests
response = requests.get("https://api.nytimes.com/svc/books/v3/lists.json?list=hardcover-fiction&published-date=2009-06-21&api-key=422004d03a794f1db979e02a81969b56")
data = response.json()
#print books on hardcover fiction bestseller list
print("On Father's Day in 2009, the following books topped the bestseller list: " )
for item in data['results']:
for item in item['book_details']:
print(item['title'])
In [78]:
#request data
import requests
response = requests.get("https://api.nytimes.com/svc/books/v3/lists.json?list=hardcover-fiction&published-date=2010-06-20&api-key=422004d03a794f1db979e02a81969b56")
data = response.json()
#print books on hardcover fiction bestseller list
print("On Father's Day in 2010, the following books topped the bestseller list: " )
for item in data['results']:
for item in item['book_details']:
print(item['title'])